make _gtk_style_property_resolve copy the result to an output value
authorAlexander Larsson <alexl@redhat.com>
Tue, 15 Nov 2011 16:15:49 +0000 (17:15 +0100)
committerAlexander Larsson <alexl@redhat.com>
Thu, 17 Nov 2011 11:27:23 +0000 (12:27 +0100)
This is preparation for allowing it to return a newly created
value, rather than just copying one.

gtk/gtkstyleproperties.c
gtk/gtkstyleproperty.c
gtk/gtkstylepropertyprivate.h

index b25f92b1732c821a235e6148c3007ce15e8de609..318280277ab8c64398319c2cc7af0805c5414c77 100644 (file)
@@ -672,10 +672,7 @@ _gtk_style_properties_get_property (GtkStyleProperties *props,
   g_value_init (value, node->pspec->value_type);
 
   if (val)
-    {
-      _gtk_style_property_resolve (node, props, state, context, val);
-      g_value_copy (val, value);
-    }
+    _gtk_style_property_resolve (node, props, state, context, val, value);
   else if (_gtk_style_property_is_shorthand (node))
     _gtk_style_property_pack (node, props, state, context, value);
   else
index 2ece9b65de047122e2717db9a9ced6d91698cc9d..1c73d30294144ae95a51d7d2cec848b2ba815129 100644 (file)
@@ -2519,19 +2519,20 @@ _gtk_style_property_resolve (const GtkStyleProperty *property,
                              GtkStyleProperties     *props,
                              GtkStateFlags           state,
                             GtkStylePropertyContext *context,
-                             GValue                 *val)
+                             GValue                 *val,
+                            GValue                 *val_out)
 {
   if (G_VALUE_TYPE (val) == GTK_TYPE_SYMBOLIC_COLOR)
     {
       if (property->pspec->value_type == GDK_TYPE_RGBA)
         {
           if (resolve_color (props, val))
-            return;
+            goto out;
         }
       else if (property->pspec->value_type == GDK_TYPE_COLOR)
         {
           if (resolve_color_rgb (props, val))
-            return;
+            goto out;
         }
       
       g_value_unset (val);
@@ -2559,6 +2560,9 @@ _gtk_style_property_resolve (const GtkStyleProperty *property,
       if (!resolve_shadow (props, val))
         _gtk_style_property_default_value (property, props, state, val);
     }
+
+ out:
+  g_value_copy (val, val_out);
 }
 
 gboolean
index 07994d5f2620700d3a66c70631e979068d0a6a97..6aa6d59c541841db56100805d2c29868458267cc 100644 (file)
@@ -85,7 +85,8 @@ void                     _gtk_style_property_resolve       (const GtkStyleProper
                                                             GtkStyleProperties     *properties,
                                                             GtkStateFlags           state,
                                                            GtkStylePropertyContext *context,
-                                                            GValue                 *orig_value);
+                                                            GValue                 *orig_value,
+                                                            GValue                 *out_value);
 
 gboolean                 _gtk_style_property_is_shorthand  (const GtkStyleProperty *property);
 GParameter *             _gtk_style_property_unpack        (const GtkStyleProperty *property,